---
title: oras attach
sidebar_position: 10
warning: Do NOT modify this generated file
---

# oras attach

Attach files to an existing artifact

```bash
oras attach [flags] --artifact-type=<type> <name>{:<tag>|@<digest>} {<file>[:<layer_media_type>]|--annotation <key>=<value>} [...]
```

## Examples

Attach file 'hi.txt' with artifact type 'doc/example' to manifest 'hello:v1' in registry 'localhost:5000':

```bash
oras attach --artifact-type doc/example localhost:5000/hello:v1 hi.txt
```

Attach file 'hi.txt' to a specific artifact with platform 'linux/amd64' in multi-arch index 'hello:v1'

```bash
oras attach --artifact-type doc/example --platform linux/amd64 localhost:5000/hello:v1 hi.txt
```

Push file "hi.txt" with the custom layer media type 'application/vnd.me.hi':

```bash
oras attach --artifact-type doc/example localhost:5000/hello:v1 hi.txt:application/vnd.me.hi
```

Attach file "hi.txt" using a specific method for the Referrers API:

```bash
oras attach --artifact-type doc/example --distribution-spec v1.1-referrers-api localhost:5000/hello:v1 hi.txt # via API
oras attach --artifact-type doc/example --distribution-spec v1.1-referrers-tag localhost:5000/hello:v1 hi.txt # via tag scheme
```

Attach file 'hi.txt' and add annotations from file 'annotation.json':

```bash
oras attach --artifact-type doc/example --annotation-file annotation.json localhost:5000/hello:v1 hi.txt
```

Attach an artifact with manifest annotations:

```bash
oras attach --artifact-type doc/example --annotation "key1=val1" --annotation "key2=val2" localhost:5000/hello:v1
```

Attach file 'hi.txt' and add manifest annotations:

```bash
oras attach --artifact-type doc/example --annotation "key=val" localhost:5000/hello:v1 hi.txt
```

[Experimental] Attach file 'hi.txt' and format output in JSON:

```bash
oras attach --artifact-type doc/example localhost:5000/hello:v1 hi.txt --format json
```

[Experimental] Attach file 'hi.txt' and format output with Go template:

```bash
oras attach --artifact-type doc/example localhost:5000/hello:v1 hi.txt --format go-template --template "{{.digest}}"
```

Attach file 'hi.txt' and export the pushed manifest to 'manifest.json':

```bash
oras attach --artifact-type doc/example --export-manifest manifest.json localhost:5000/hello:v1 hi.txt
```

Attach file to the manifest tagged 'v1' in an OCI image layout folder 'layout-dir':

```bash
oras attach --oci-layout --artifact-type doc/example layout-dir:v1 hi.txt
```

Attach file to the manifest tagged 'example.com:v1' in an OCI image layout folder 'layout-dir':

```bash
oras attach --artifact-type doc/example --oci-layout-path layout-dir example.com:v1 hi.txt
```

## Options

```
  -a, --annotation stringArray                      manifest annotations
      --annotation-file string                      path of the annotation file
      --artifact-type string                        artifact type
      --ca-file string                              server certificate authority file for the remote registry
      --cert-file string                            client certificate file for the remote registry
      --concurrency int                             concurrency level (default 5)
  -d, --debug                                       output debug logs (implies --no-tty)
      --disable-path-validation                     skip path validation
      --distribution-spec string                    [Preview] set OCI distribution spec version and API option for target. Options: v1.1-referrers-tag, v1.1-referrers-api
      --export-manifest path                        path of the pushed manifest
      --format string                               [Experimental] format output using a custom template:
                                                    'json':         Print in JSON format
                                                    'go-template':  Print output using the given Go template
                                                    'text':         Print in text format (default "text")
  -H, --header stringArray                          add custom headers to requests
  -h, --help                                        help for attach
      --identity-token string                       registry identity token
      --identity-token-stdin                        read identity token from stdin
      --insecure                                    allow connections to SSL registry without certs
      --key-file string                             client private key file for the remote registry
      --no-tty                                      [Preview] disable progress bars
      --oci-layout                                  set target as an OCI image layout
      --oci-layout-path string                      [Experimental] set the path for the OCI image layout target
  -p, --password string                             registry password or identity token
      --password-stdin                              read password from stdin
      --plain-http                                  allow insecure connections to registry without SSL check
      --platform os[/arch][/variant][:os_version]   attach to an arch-specific subject in the form of os[/arch][/variant][:os_version]
      --registry-config path                        path of the authentication file for registry
      --resolve host:port:address[:address_port]    customized DNS for registry, formatted in host:port:address[:address_port]
      --template string                             [Experimental] template string used to format output
  -u, --username string                             registry username
```
